package Thread;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: LianBao
 * Date: 2024-07-29
 * Time: 20:09
 */

/**
 * 前台线程,后台线程
 */
public class demo6 {
    public static void main(String[] args) {
        Thread t = new Thread(()->{
            while (true) {
                System.out.println("Hello Thread");
                try {
                    Thread.sleep(1000);
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
            }
        });
        t.setDaemon(true);//把t设为后台线程
        t.start();
        System.out.println(t.isDaemon());
    }
}
